package com.protocols.sctp.m3ua.sccp.tcap.camel;

import java.io.Serializable;

import com.protocols.BCDNumber;
import com.protocols.GeneralProtocolData;
import com.protocols.OctaveInteger;
import com.protocols.ProtoOperations;
import com.protocols.ProtocolStackException;
import com.protocols.sctp.m3ua.sccp.tcap.TcapBegin;
import com.protocols.sctp.m3ua.sccp.tcap.TcapConstructor;
import com.protocols.sctp.m3ua.sccp.tcap.TcapPrimitiveUnitByteArray;
import com.protocols.sctp.m3ua.sccp.tcap.TcapPrimitiveUnitNumber;

public class CamelReject implements GeneralProtocolData,Serializable{

	private TcapConstructor Reject = new TcapConstructor(0xa4);
	private TcapPrimitiveUnitNumber InvokeID = new TcapPrimitiveUnitNumber(0x02);
	private TcapPrimitiveUnitNumber GeneralProblem = new TcapPrimitiveUnitNumber(0x80);
	private TcapPrimitiveUnitNumber InvokeProblem = new TcapPrimitiveUnitNumber(0x81);
	private TcapPrimitiveUnitNumber ReturnResultProblem = new TcapPrimitiveUnitNumber(0x82);
	private TcapPrimitiveUnitNumber ReturnErrorProblem = new TcapPrimitiveUnitNumber(0x83);
	public CamelReject() {
		
		Reject.addElement(InvokeID);
		Reject.addElement(GeneralProblem);		
		Reject.addElement(InvokeProblem);		
		Reject.addElement(ReturnResultProblem);		
		Reject.addElement(ReturnErrorProblem);		
	}
	
	public byte [] getByteArray(){	
		return Reject.getByteArray();
		

	}	

	public long getInvokeID() {
		return InvokeID.getTagValue();
	}

	public void setInvokeID(long invokeID) {
		InvokeID.setTagValue(invokeID);
	}	
	
	

	@Override
	public int getLength() {
		return getByteArray().length;
	}

	@Override
	public byte[] decode(byte[] input) throws ProtocolStackException {
		
		return Reject.decode(input);
	}

	public long getGeneralProblem() {
		return GeneralProblem.getTagValue();
	}

	public void setGeneralProblem(long generalProblem) {
		GeneralProblem.setTagValue(generalProblem);
		InvokeProblem.setVisible(false);
		ReturnResultProblem.setVisible(false);
		ReturnErrorProblem.setVisible(false);
	}

	public long getInvokeProblem() {
		return InvokeProblem.getTagValue();
	}

	public void setInvokeProblem(long invokeProblem) {
		InvokeProblem.setTagValue( invokeProblem);
		GeneralProblem.setVisible(false);
		ReturnResultProblem.setVisible(false);
		ReturnErrorProblem.setVisible(false);
	}

	public long getReturnResultProblem() {
		return ReturnResultProblem.getTagValue();
	}

	public void setReturnResultProblem(long returnResultProblem) {
		ReturnResultProblem.setTagValue( returnResultProblem);
		GeneralProblem.setVisible(false);
		InvokeProblem.setVisible(false);
		ReturnErrorProblem.setVisible(false);
	}

	public long getReturnErrorProblem() {
		return ReturnErrorProblem.getTagValue();
	}

	public void setReturnErrorProblem(long returnErrorProblem) {
		ReturnErrorProblem.setTagValue(returnErrorProblem);
		GeneralProblem.setVisible(false);
		InvokeProblem.setVisible(false);
		ReturnResultProblem.setVisible(false);
	}
	
	
	public TcapConstructor getRootComponent(){
		return Reject;
	}
}
